/* This class will get the Carbs that the user will input eiher manually or selecting items from 
 *the list in the Bolus screen 
 */
package my.simpleinsulinpump;
import java.text.DecimalFormat;

/**
 *
 * @author arianareyessantiago
 */
public class Bolus{
    Double conversionRate = 13.00;
    public Double totalInsulin(Double currentTotalCarbs){
        Double insulinUnits = roundTwoDecimals(currentTotalCarbs/conversionRate);
        System.out.println("From Bolus class:" + insulinUnits);
        return insulinUnits;
    }
    public double roundTwoDecimals(double d){
        DecimalFormat twoDForm = new DecimalFormat("#.##");
        return Double.valueOf(twoDForm.format(d));
}
    public String [] chooseSubList(String itemOption){
        String [] breakfastArray = {"Cereal -- 5 g", "Bagel -- 15 g", "Toast -- 15 g", "Egg -- 5 g"};
        String [] meatArray = {"Bacon -- 10 g", "Turkey -- 8 g", "Chicken -- 9 g"};
        String [] fishArray = {"Salmon -- 12 g", "Tilapia -- 7 g", "Tuna -- 5 g", "Shrimp -- 9 g"};
        String [] snacksArray = {"Almonds -- 25 g", "Greek Yogurt -- 9 g", "Yogurt -- 8 g", "Apple -- 10 g", "Carrots -- 7 g"};
        String [] juicesArray = {"Apple -- 19 g", "Orange -- 15 g", "Cranberry -- 10 g", "Grape -- 12 g"};
        String [] subList = {};
        if("Breakfast".equals(itemOption)) {
            subList = breakfastArray;
        } else if ("Meat".equals(itemOption)){
           subList = meatArray;
        } else if ("Snacks".equals(itemOption)){
            subList = snacksArray;
        } else if ("Fish".equals(itemOption)){
            subList = fishArray;
        } else if ("Juices".equals(itemOption)){
            subList = juicesArray;
        }
        return subList;
    }
}
